import 'package:get/get.dart';
import 'package:mziot/app/modules/auth/profile/controllers/auth_profile_controller.dart';
import 'package:mziot/app/modules/circle/controllers/circle_controller.dart';
import 'package:mziot/app/modules/home/controllers/home_controller.dart';
import 'package:mziot/app/modules/scene/controllers/scene_controller.dart';

class TabbarController extends GetxController {
  //TODO: Implement TabbarController
  final index = 0.obs;

  @override
  void onInit() {
    super.onInit();
    Get.lazyPut(() => HomeController());
    Get.lazyPut(() => SceneController());
    Get.lazyPut(() => CircleController());
    Get.lazyPut(() => AuthProfileController());

    index.listen((p0) {
      if (p0 == 0) {
        Get.find<HomeController>().refreshAction();
      } else if (p0 == 3) {
        Get.find<AuthProfileController>().fetchMineInfo();
      }
    });
  }

  @override
  void onReady() {
    super.onReady();
  }

  @override
  void onClose() {}
}
